package com.aioz.security.controller;


import com.aioz.security.aop.annotation.LogInfoAnnotation;
import com.aioz.security.common.ResponseResult;
import com.aioz.security.entity.Interview;
import com.aioz.security.service.impl.InterviewServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Aioz
 * @since 2022-09-27
 */
@RestController
@RequestMapping("/interview")
public class InterviewController {

    @Resource
    private InterviewServiceImpl interviewService;

    //查看全部面试
    @GetMapping("/get/all")
    @LogInfoAnnotation
    public ResponseResult getAllInterViews(){
        return interviewService.getAllInterViews();
    }


    // 企业HR对求职者面试邀请
    @PostMapping("/invite/{id}")
    @LogInfoAnnotation
    public ResponseResult inviteInterview(@RequestBody Interview interview,
                                          @PathVariable Integer id){
        return interviewService.inviteInterview(interview,id);
    }

    //求职者查看全部面试通知
    @GetMapping("/check")
    @LogInfoAnnotation
    public ResponseResult checkInterview(){
        return interviewService.checkInterview();
    }

    //求职者查看具体申请面试通知
    @PostMapping("/specific/one/{positionId}")
    @LogInfoAnnotation
    public ResponseResult checkSpecificInterview(@PathVariable("positionId") Integer positionId){
        return interviewService.checkSpecificInterview(positionId);
    }

    // 企业HR对面试审批
    @PostMapping("/approve")
    @LogInfoAnnotation
    public ResponseResult approveInterview(@RequestBody Interview interview){
        return interviewService.approveInterview(interview);
    }

    // 求职者查看面试结果
    @PostMapping("/get/result")
    @LogInfoAnnotation
    public ResponseResult getResultInterview(){
        return interviewService.getResultInterview();
    }
}
